package tables

import (
	"github.com/GoAdminGroup/go-admin/context"
	"github.com/GoAdminGroup/go-admin/modules/db"
	"github.com/GoAdminGroup/go-admin/plugins/admin/modules/table"
	"github.com/GoAdminGroup/go-admin/template/types/form"
)

func GetAycontentextTable(ctx *context.Context) table.Table {

	cfg := table.DefaultConfigWithDriverAndConnection("sqlite", "pbootcms")
	cfg=cfg.SetPrimaryKey("extid", db.Integer)

	ayContentExt := table.NewDefaultTable(ctx, cfg)
	println(ayContentExt.GetPrimaryKey().Name)
	info := ayContentExt.GetInfo()

	info.AddField("Extid", "extid", db.Integer)
	info.AddField("Contentid", "contentid", db.Integer)
	info.AddField("产品价格", "ext_price", db.Text)
	info.AddField("类型", "ext_type", db.Text)
	info.AddField("颜色", "ext_color", db.Text)

	info.SetTable("ay_content_ext").SetTitle("链接").SetDescription("链接")

	formList := ayContentExt.GetForm()
	formList.AddField("Extid", "extid", db.Integer, form.Number)
	formList.AddField("Contentid", "contentid", db.Integer, form.Number)
	formList.AddField("产品价格", "ext_price", db.Text, form.Text)
	formList.AddField("类型", "ext_type", db.Text, form.Text)
	formList.AddField("颜色", "ext_color", db.Text, form.Text)

	formList.SetTable("ay_content_ext").SetTitle("编辑链接").SetDescription("编辑链接")

	return ayContentExt
}
